<?php

namespace app\common\service\order\order_status\items;

use app\model\CouponOrder;

/**
 * 已结算
 */
class OrderStatusSettle extends OrderStatusBase
{
    public static function handle(CouponOrder $couponOrder, $next)
    {

        //支付状态
        if (CouponOrder::C_PAY_STATUS_YES != $couponOrder->pay_status) {
            return $next($couponOrder);
        }

        //订单状态
        if (CouponOrder::C_STATUS_RECHARGE_SUCCESS != $couponOrder->status) {
            return $next($couponOrder);
        }

        if ($couponOrder->agent_settle_status == CouponOrder::C_AGENT_SETTLE_STATUS_SUCCESS ){
            return  $couponOrder->params['return_status'] =  self::getReturnStatus(self::SETTLE,'已结算'); //其实是已结算了
        }

        return $next($couponOrder);
    }
}